<?php 
/**
 * User: Administrator、
 */
namespace app\home\controller;
use think\Controller;
use think\Db;
use app\home\model\ContentModel;
class Common extends Controller
{
    private $website=array();
	private $ConModel,$colorys;
    public function _initialize(){
        $Controller=controller('common/Common');
        $this->website=$Controller->GetInfo();
        $this->assign('website',$this->website['Site']);
		$this->ConModel = new ContentModel();
		//颜色值
		$this->colorys = $this->ConModel->hex2rgb();
		$this->assign('colorys',$this->colorys);

		//栏目列表Start
		$sortlist=$this->ConModel->getSortList();
		foreach($sortlist as $n=> $val){
			//查找子栏目
			$son=$this->ConModel->getSonScodes($val['scode']);
			if($son){
				foreach($son as $k=> $val2){
					//$son[$k]['link']='/Index/'.$val['urlname'].'/'.$val2['scode'].'';
					if($val2['type']!=1){
						$son[$k]['link']=url($val2['urlname'].'list',['tid'=>$val2['scode']]);
					}else{
						$son[$k]['link']=url($val2['urlname'],['tid'=>$val2['scode']]);
					}

				}				
				$sortlist[$n]['son']=$son;
			}else{
				$sortlist[$n]['son']=false;
			}
			if($val['type']!=1){
				$sortlist[$n]['link']=url($val['urlname'].'list',['tid'=>$val['scode']]);
			}else{
				$sortlist[$n]['link']=url($val['urlname'],['tid'=>$val['scode']]);
			}

			//$sortlist[$n]['link']='/Index/'.$val['urlname'].'/'.$val['scode'].'';
		}
		$this->assign('sortlist',$sortlist);
		//End

		//单位信息调用
		$company=$this->ConModel->getCompany();
		$this->assign('company',$company);
    }
}